<template>
  <div class="box">
    <div class="left">
      <div class="up">
        <img src="@/assets/logo.svg" />
        <p>朗驰科技内部管理平台</p>
      </div>
    </div>
    <div class="right">
      <div class="main">
        <div class="clearfix">
          <div slot="header">
            <span style="font-family: 华文行楷; font-size: 40px; color: white"
              >管理员登录</span
            >
          </div>
        </div>
        <table>
          <tr>
            <td style="font-family: 华文行楷; font-size: 20px; color: white">
              用户名：
            </td>
            <td>
              <el-input
                placeholder="请输入用户名"
                type="text"
                v-model="loginInfo.username"
              ></el-input>
            </td>
          </tr>
          <br />
          <tr>
            <td style="font-family: 华文行楷; font-size: 20px; color: white">
              密&nbsp;&nbsp;码：
            </td>
            <td>
              <el-input
                type="password"
                placeholder="请输入密码"
                v-model="loginInfo.password"
              ></el-input>
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <el-button
                type="primary"
                @click="loginIn"
                style="
                  font-family: 华文行楷;
                  font-size: 30px;
                  width: 300px;
                  margin-top: 35px;
                "
                >登&nbsp;&nbsp;&nbsp;录</el-button
              >
            </td>
          </tr>
        </table>
      </div>
      <!-- <div class="y"></div> -->
      <!-- <div class="one">
        <p>欢迎登入</p>
        <input
          type="text"
          placeholder="用户名"
          v-model="loginInfo.username"
        /><br />
        <input
          type="password"
          placeholder="密码"
          v-model="loginInfo.password"
        /><br />
        <button @click="loginIn">登录</button>
      </div> -->
    </div>
  </div>
</template>

<script>
import axios from "axios";

export default {
  name: "Login",
  data() {
    return {
      loginInfo: {
        username: "admin",
        password: "123456",
      },
    };
  },
  methods: {
    async loginIn() {
      // print()
      let data = this.loginInfo;
      let result = await axios({
        url: "/api/empSysUser/login",
        method: "post",
        params: data,
      });
      if (result.data.code == 200) {
        // console.log(result);
        sessionStorage.setItem("username", result.data.data.username);
        sessionStorage.setItem("role", result.data.data.role);
        this.$router.push("/home");
      }
    },
  },
};
</script>

<style lang="less" scoped>
.box {
  width: 100%;
  height: 100vh;
  display: flex;

  .left {
    width: 100%;
    height: 100%;
    position: relative;
    background-color: #ffffff;
    background-size: 100%;
    position: relative;
    background-repeat: no-repeat;
    background-position: bottom right;
    // background-image: url("@/assets/bg.png");
    background-image: url("@/assets/bgc2.jpg");
    .up {
      width: 100%;
      position: absolute;
      top: -30px;
      left: 13%;
      // transform: translate(-50%, -50%);
      img {
        width: 200px;
        margin-left: 30px;
        margin-top: 48px;
      }
      p {
        display: inline-block;
        margin-top: 120px;
        margin-left: 20px;
        font-size: 100px;
        color: #ffffff;
        font-family: 华文行楷;
      }
    }
  }
  .right {
    width: 100%;
    height: 80%;
    position: absolute;
    top: 80px;
    right: -100px;
    overflow: hidden;
    .main {
      position: absolute;
      top: 60%;
      left: 45%;
      transform: translate(-50%, -50%);
      background-image: linear-gradient(rgba(255, 255, 255, 0.418), #0a306f);
      // background-color: rgba(255, 255, 255, 0.418);
      width: 500px;
      height: 340px;
      text-align: center;
      padding-top: 50px;
      // box-shadow: 12px 12px 5px #042170;
      .clearfix {
        text-align: center;
      }
      table {
        margin: 30px auto;
        .el-button {
          // background-color: rgba(196, 188, 188, 0.308);
          // opacity: 0.5;
          width: 100px;
          border: 0;
        }
      }
    }
  }
}
</style>
